﻿namespace HuaWei.CBR.QTJL
{
    using DevExpress.Utils;
    using DevExpress.XtraEditors;
    using DevExpress.XtraEditors.Controls;
    using DevExpress.XtraEditors.Repository;
    using DevExpress.XtraGrid;
    using DevExpress.XtraGrid.Columns;
    using DevExpress.XtraGrid.Views.Base;
    using DevExpress.XtraGrid.Views.Grid;
    using HuaWei.CommClass;
    using HuaWei.CommComp;
    using HuaWei.Common;
    using HuaWei.Windows.Forms;
    using System;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Windows.Forms;

    public class FrmCLYFK_GQKH : FrmBase
    {
        private BindingSource bindingSource;
        private BindingSource bindingSource1;
        private BindingSource bindingSource2;
        private GridColumn colPH;
        private GQKK gqkk = null;
        private GridColumn gridColumn19;
        private GridColumn gridColumn20;
        private GridColumn gridColumn21;
        private GridColumn gridColumn22;
        private GridColumn gridColumn23;
        private GridColumn gridColumn39;
        private GridColumn gridColumn40;
        private GridColumn gridColumn41;
        private GridColumn gridColumn44;
        private GridColumn gridColumn46;
        private GridControl gridControl10;
        private GridControl gridControl6;
        private GridView gridView;
        private GridView gridView6;
        private IContainer icontainer1 = null;
        private LabelControl labelControl28;
        private LabelControl labelControl29;
        private LabelControl labelControl30;
        private LabelControl labelControl31;
        private LabelControl labelControl32;
        private LabelControl labelControl34;
        private LabelControl labelControl35;
        private LabelControl labelControl36;
        private LabelControl labelControl37;
        private LabelControl labelControl38;
        private PanelControl panelControl1;
        private PanelControl panelControl16;
        private PanelControl panelControl17;
        private RepositoryItemCheckEdit repositoryItemCheckEdit4;
        private SimpleButton simpleButton;
        private SimpleButton simpleButton1;
        private SimpleButton simpleButton2;
        private SimpleButton simpleButton24;
        private SimpleButton simpleButton3;
        private TextEdit textEdit;
        private TextEdit textEdit1;
        private TextEdit textEdit2;
        private TextEdit textEdit3;
        private TextEdit textEdit4;
        private LabelControl XDSLSFKWM;

        public FrmCLYFK_GQKH()
        {
            this.InitializeComponent();
            this.gridColumn22.OptionsColumn.ReadOnly = GParams._JGLX.Equals(JGLX.CBR);
        }

        private void bindingSource1_PositionChanged(object sender, EventArgs e)
        {
            this.ControlFormStatus();
        }

        private void bindingSource2_PositionChanged(object sender, EventArgs e)
        {
            base.Save();
            this.method7();
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.icontainer1 != null))
            {
                this.icontainer1.Dispose();
            }
            base.Dispose(disposing);
        }

        private void FrmCLYFK_GQKH_Load(object sender, EventArgs e)
        {
            this.LoadData();
        }

        private void gridView6_CellValueChanged(object sender, CellValueChangedEventArgs e)
        {
            if (e.Column.FieldName.Equals("TYSB"))
            {
                if (CHelp.ConvertInt(e.Value, 0).Equals(1))
                {
                    DevCCHelp.ControlForm(base.Controls, true, 1);
                }
                else
                {
                    DevCCHelp.ControlForm(base.Controls, false, 1);
                }
            }
        }

        private void InitializeComponent()
        {
            this.icontainer1 = new Container();
            this.gridControl6 = new GridControl();
            this.bindingSource1 = new BindingSource(this.icontainer1);
            this.gridView6 = new GridView();
            this.colPH = new GridColumn();
            this.gridColumn19 = new GridColumn();
            this.gridColumn20 = new GridColumn();
            this.gridColumn21 = new GridColumn();
            this.gridColumn22 = new GridColumn();
            this.gridColumn23 = new GridColumn();
            this.gridColumn39 = new GridColumn();
            this.repositoryItemCheckEdit4 = new RepositoryItemCheckEdit();
            this.gridControl10 = new GridControl();
            this.bindingSource2 = new BindingSource(this.icontainer1);
            this.gridView = new GridView();
            this.gridColumn40 = new GridColumn();
            this.gridColumn41 = new GridColumn();
            this.gridColumn44 = new GridColumn();
            this.gridColumn46 = new GridColumn();
            this.panelControl17 = new PanelControl();
            this.simpleButton2 = new SimpleButton();
            this.simpleButton1 = new SimpleButton();
            this.simpleButton = new SimpleButton();
            this.panelControl16 = new PanelControl();
            this.labelControl38 = new LabelControl();
            this.textEdit = new TextEdit();
            this.bindingSource = new BindingSource(this.icontainer1);
            this.labelControl37 = new LabelControl();
            this.textEdit1 = new TextEdit();
            this.labelControl36 = new LabelControl();
            this.textEdit2 = new TextEdit();
            this.labelControl35 = new LabelControl();
            this.textEdit3 = new TextEdit();
            this.labelControl34 = new LabelControl();
            this.labelControl28 = new LabelControl();
            this.labelControl29 = new LabelControl();
            this.labelControl30 = new LabelControl();
            this.labelControl31 = new LabelControl();
            this.textEdit4 = new TextEdit();
            this.labelControl32 = new LabelControl();
            this.XDSLSFKWM = new LabelControl();
            this.panelControl1 = new PanelControl();
            this.simpleButton24 = new SimpleButton();
            this.simpleButton3 = new SimpleButton();
            base.ds.BeginInit();
            base.dsQuery.BeginInit();
            base.dataSets.BeginInit();
            this.gridControl6.BeginInit();
            ((ISupportInitialize) this.bindingSource1).BeginInit();
            this.gridView6.BeginInit();
            this.repositoryItemCheckEdit4.BeginInit();
            this.gridControl10.BeginInit();
            ((ISupportInitialize) this.bindingSource2).BeginInit();
            this.gridView.BeginInit();
            this.panelControl17.BeginInit();
            this.panelControl17.SuspendLayout();
            this.panelControl16.BeginInit();
            this.panelControl16.SuspendLayout();
            this.textEdit.Properties.BeginInit();
            ((ISupportInitialize) this.bindingSource).BeginInit();
            this.textEdit1.Properties.BeginInit();
            this.textEdit2.Properties.BeginInit();
            this.textEdit3.Properties.BeginInit();
            this.textEdit4.Properties.BeginInit();
            this.panelControl1.BeginInit();
            this.panelControl1.SuspendLayout();
            base.SuspendLayout();
            this.gridControl6.DataMember = null;
            this.gridControl6.DataSource = this.bindingSource1;
            this.gridControl6.Dock = DockStyle.Fill;
            this.gridControl6.EmbeddedNavigator.Buttons.Edit.Visible = false;
            this.gridControl6.Location = new Point(0x183, 0xa8);
            this.gridControl6.MainView = this.gridView6;
            this.gridControl6.Name = "gridControl6";
            this.gridControl6.RepositoryItems.AddRange(new RepositoryItem[] { this.repositoryItemCheckEdit4 });
            this.gridControl6.Size = new Size(0x20e, 0x153);
            this.gridControl6.TabIndex = 0x21;
            this.gridControl6.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] { this.gridView6 });
            this.bindingSource1.DataMember = "QTJL_CLYFKCLPC";
            this.bindingSource1.DataSource = base.dataSets;
            this.gridView6.Columns.AddRange(new GridColumn[] { this.colPH, this.gridColumn19, this.gridColumn20, this.gridColumn21, this.gridColumn22, this.gridColumn23, this.gridColumn39 });
            this.gridView6.GridControl = this.gridControl6;
            this.gridView6.Name = "gridView6";
            this.gridView6.OptionsCustomization.AllowFilter = false;
            this.gridView6.OptionsCustomization.AllowSort = false;
            this.gridView6.OptionsNavigation.EnterMoveNextColumn = true;
            this.gridView6.OptionsView.ColumnAutoWidth = false;
            this.gridView6.OptionsView.ShowGroupPanel = false;
            this.gridView6.OptionsView.ShowIndicator = false;
            this.gridView6.CellValueChanged += new CellValueChangedEventHandler(this.gridView6_CellValueChanged);
            this.colPH.Caption = "批号";
            this.colPH.FieldName = "PH";
            this.colPH.Name = "colPH";
            this.colPH.Visible = true;
            this.colPH.VisibleIndex = 0;
            this.colPH.Width = 0x33;
            this.gridColumn19.Caption = "单价";
            this.gridColumn19.DisplayFormat.FormatString = "0.00";
            this.gridColumn19.DisplayFormat.FormatType = FormatType.Numeric;
            this.gridColumn19.FieldName = "DJ";
            this.gridColumn19.Name = "gridColumn19";
            this.gridColumn19.Visible = true;
            this.gridColumn19.VisibleIndex = 1;
            this.gridColumn19.Width = 0x4f;
            this.gridColumn20.Caption = "数量";
            this.gridColumn20.DisplayFormat.FormatString = "0.00";
            this.gridColumn20.DisplayFormat.FormatType = FormatType.Numeric;
            this.gridColumn20.FieldName = "SL";
            this.gridColumn20.Name = "gridColumn20";
            this.gridColumn20.Visible = true;
            this.gridColumn20.VisibleIndex = 2;
            this.gridColumn20.Width = 0x45;
            this.gridColumn21.Caption = "金额";
            this.gridColumn21.DisplayFormat.FormatString = "0.00";
            this.gridColumn21.DisplayFormat.FormatType = FormatType.Numeric;
            this.gridColumn21.FieldName = "JE";
            this.gridColumn21.Name = "gridColumn21";
            this.gridColumn21.OptionsColumn.ReadOnly = true;
            this.gridColumn21.Tag = "-3";
            this.gridColumn21.Visible = true;
            this.gridColumn21.VisibleIndex = 3;
            this.gridColumn21.Width = 0x5e;
            this.gridColumn22.Caption = "垫付比例%";
            this.gridColumn22.FieldName = "DFBL";
            this.gridColumn22.Name = "gridColumn22";
            this.gridColumn22.Tag = "-3";
            this.gridColumn22.Visible = true;
            this.gridColumn22.VisibleIndex = 4;
            this.gridColumn22.Width = 0x49;
            this.gridColumn23.Caption = "垫付金额";
            this.gridColumn23.DisplayFormat.FormatString = "0.00";
            this.gridColumn23.DisplayFormat.FormatType = FormatType.Numeric;
            this.gridColumn23.FieldName = "DFJE";
            this.gridColumn23.Name = "gridColumn23";
            this.gridColumn23.OptionsColumn.ReadOnly = true;
            this.gridColumn23.Tag = "-3";
            this.gridColumn23.Visible = true;
            this.gridColumn23.VisibleIndex = 5;
            this.gridColumn23.Width = 0x5d;
            this.gridColumn39.Caption = "同意上报";
            this.gridColumn39.ColumnEdit = this.repositoryItemCheckEdit4;
            this.gridColumn39.FieldName = "TYSB";
            this.gridColumn39.Name = "gridColumn39";
            this.gridColumn39.Tag = "-1";
            this.gridColumn39.Visible = true;
            this.gridColumn39.VisibleIndex = 6;
            this.gridColumn39.Width = 60;
            this.repositoryItemCheckEdit4.AutoHeight = false;
            this.repositoryItemCheckEdit4.DisplayValueChecked = "1";
            this.repositoryItemCheckEdit4.DisplayValueUnchecked = "0";
            this.repositoryItemCheckEdit4.EditValueChangedFiringMode = EditValueChangedFiringMode.Buffered;
            this.repositoryItemCheckEdit4.Name = "repositoryItemCheckEdit4";
            this.repositoryItemCheckEdit4.ValueChecked = 1;
            this.repositoryItemCheckEdit4.ValueUnchecked = 0;
            this.gridControl10.DataMember = null;
            this.gridControl10.DataSource = this.bindingSource2;
            this.gridControl10.Dock = DockStyle.Left;
            this.gridControl10.EmbeddedNavigator.Buttons.Edit.Visible = false;
            this.gridControl10.Location = new Point(0, 0x8d);
            this.gridControl10.MainView = this.gridView;
            this.gridControl10.Name = "gridControl10";
            this.gridControl10.Size = new Size(0x183, 0x16e);
            this.gridControl10.TabIndex = 0x23;
            this.gridControl10.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] { this.gridView });
            this.bindingSource2.DataMember = "QTJL_CLYFKCL";
            this.bindingSource2.DataSource = base.dataSets;
            this.gridView.Columns.AddRange(new GridColumn[] { this.gridColumn40, this.gridColumn41, this.gridColumn44, this.gridColumn46 });
            this.gridView.GridControl = this.gridControl10;
            this.gridView.Name = "gridView10";
            this.gridView.OptionsBehavior.ReadOnly = true;
            this.gridView.OptionsCustomization.AllowFilter = false;
            this.gridView.OptionsCustomization.AllowSort = false;
            this.gridView.OptionsView.ColumnAutoWidth = false;
            this.gridView.OptionsView.ShowGroupPanel = false;
            this.gridView.OptionsView.ShowIndicator = false;
            this.gridColumn40.Caption = "材料名称";
            this.gridColumn40.FieldName = "CLMC";
            this.gridColumn40.Name = "gridColumn40";
            this.gridColumn40.Visible = true;
            this.gridColumn40.VisibleIndex = 0;
            this.gridColumn40.Width = 0x7f;
            this.gridColumn41.Caption = "单位";
            this.gridColumn41.FieldName = "DW";
            this.gridColumn41.Name = "gridColumn41";
            this.gridColumn41.Visible = true;
            this.gridColumn41.VisibleIndex = 1;
            this.gridColumn41.Width = 0x40;
            this.gridColumn44.Caption = "金额";
            this.gridColumn44.DisplayFormat.FormatString = "0.00";
            this.gridColumn44.DisplayFormat.FormatType = FormatType.Numeric;
            this.gridColumn44.FieldName = "JE";
            this.gridColumn44.Name = "gridColumn44";
            this.gridColumn44.Visible = true;
            this.gridColumn44.VisibleIndex = 2;
            this.gridColumn44.Width = 0x3a;
            this.gridColumn46.Caption = "垫付金额";
            this.gridColumn46.DisplayFormat.FormatString = "0.00";
            this.gridColumn46.DisplayFormat.FormatType = FormatType.Numeric;
            this.gridColumn46.FieldName = "DFJE";
            this.gridColumn46.Name = "gridColumn46";
            this.gridColumn46.Visible = true;
            this.gridColumn46.VisibleIndex = 3;
            this.gridColumn46.Width = 0x6b;
            this.panelControl17.Controls.Add(this.simpleButton2);
            this.panelControl17.Controls.Add(this.simpleButton1);
            this.panelControl17.Controls.Add(this.simpleButton);
            this.panelControl17.Dock = DockStyle.Top;
            this.panelControl17.Location = new Point(0, 0x72);
            this.panelControl17.Name = "panelControl17";
            this.panelControl17.Size = new Size(0x391, 0x1b);
            this.panelControl17.TabIndex = 0x22;
            this.simpleButton2.Dock = DockStyle.Left;
            this.simpleButton2.Location = new Point(0x8e, 2);
            this.simpleButton2.Name = "simpleButton2";
            this.simpleButton2.Size = new Size(0x3a, 0x17);
            this.simpleButton2.TabIndex = 9;
            this.simpleButton2.Tag = "-2";
            this.simpleButton2.Text = "过程数据";
            this.simpleButton2.Click += new EventHandler(this.simpleButton2_Click);
            this.simpleButton1.Dock = DockStyle.Left;
            this.simpleButton1.Location = new Point(0x48, 2);
            this.simpleButton1.Name = "simpleButton1";
            this.simpleButton1.Size = new Size(70, 0x17);
            this.simpleButton1.TabIndex = 10;
            this.simpleButton1.Tag = "-1";
            this.simpleButton1.Text = "删除材料";
            this.simpleButton1.Click += new EventHandler(this.simpleButton1_Click);
            this.simpleButton.Dock = DockStyle.Left;
            this.simpleButton.Location = new Point(2, 2);
            this.simpleButton.Name = "btnSelectCL";
            this.simpleButton.Size = new Size(70, 0x17);
            this.simpleButton.TabIndex = 5;
            this.simpleButton.Tag = "-1";
            this.simpleButton.Text = "选择材料";
            this.simpleButton.Click += new EventHandler(this.simpleButton_Click);
            this.panelControl16.Controls.Add(this.labelControl38);
            this.panelControl16.Controls.Add(this.textEdit);
            this.panelControl16.Controls.Add(this.labelControl37);
            this.panelControl16.Controls.Add(this.textEdit1);
            this.panelControl16.Controls.Add(this.labelControl36);
            this.panelControl16.Controls.Add(this.textEdit2);
            this.panelControl16.Controls.Add(this.labelControl35);
            this.panelControl16.Controls.Add(this.textEdit3);
            this.panelControl16.Controls.Add(this.labelControl34);
            this.panelControl16.Controls.Add(this.labelControl28);
            this.panelControl16.Controls.Add(this.labelControl29);
            this.panelControl16.Controls.Add(this.labelControl30);
            this.panelControl16.Controls.Add(this.labelControl31);
            this.panelControl16.Controls.Add(this.textEdit4);
            this.panelControl16.Controls.Add(this.labelControl32);
            this.panelControl16.Controls.Add(this.XDSLSFKWM);
            this.panelControl16.Dock = DockStyle.Top;
            this.panelControl16.Location = new Point(0, 0);
            this.panelControl16.Name = "panelControl16";
            this.panelControl16.Size = new Size(0x391, 0x72);
            this.panelControl16.TabIndex = 0x20;
            this.labelControl38.Location = new Point(0x1be, 0x53);
            this.labelControl38.Name = "labelControl38";
            this.labelControl38.Size = new Size(0x16, 14);
            this.labelControl38.TabIndex = 0x23;
            this.labelControl38.Text = "(元)";
            this.textEdit.DataBindings.Add(new Binding("EditValue", this.bindingSource, "LJDFJE", true));
            this.textEdit.Location = new Point(340, 80);
            this.textEdit.Name = "textEdit16";
            this.textEdit.Properties.AllowFocused = false;
            this.textEdit.Properties.Appearance.BackColor = Color.WhiteSmoke;
            this.textEdit.Properties.Appearance.Options.UseBackColor = true;
            this.textEdit.Properties.DisplayFormat.FormatString = "0.00";
            this.textEdit.Properties.DisplayFormat.FormatType = FormatType.Numeric;
            this.textEdit.Properties.ReadOnly = true;
            this.textEdit.Size = new Size(100, 0x15);
            this.textEdit.TabIndex = 0x22;
            this.bindingSource.DataMember = "QTJL_CLYFK";
            this.bindingSource.DataSource = base.dataSets;
            this.labelControl37.Location = new Point(0xd5, 0x53);
            this.labelControl37.Name = "labelControl37";
            this.labelControl37.Size = new Size(0x16, 14);
            this.labelControl37.TabIndex = 0x21;
            this.labelControl37.Text = "(元)";
            this.textEdit1.DataBindings.Add(new Binding("EditValue", this.bindingSource, "BQDFJE", true));
            this.textEdit1.Location = new Point(0x6b, 80);
            this.textEdit1.Name = "textEdit15";
            this.textEdit1.Properties.AllowFocused = false;
            this.textEdit1.Properties.Appearance.BackColor = Color.WhiteSmoke;
            this.textEdit1.Properties.Appearance.Options.UseBackColor = true;
            this.textEdit1.Properties.DisplayFormat.FormatString = "0.00";
            this.textEdit1.Properties.DisplayFormat.FormatType = FormatType.Numeric;
            this.textEdit1.Properties.ReadOnly = true;
            this.textEdit1.Size = new Size(100, 0x15);
            this.textEdit1.TabIndex = 0x20;
            this.labelControl36.Location = new Point(0x2ad, 50);
            this.labelControl36.Name = "labelControl36";
            this.labelControl36.Size = new Size(0x16, 14);
            this.labelControl36.TabIndex = 0x1f;
            this.labelControl36.Text = "(元)";
            this.textEdit2.DataBindings.Add(new Binding("EditValue", this.bindingSource, "BQMKHJE", true));
            this.textEdit2.Location = new Point(0x243, 0x2f);
            this.textEdit2.Name = "edtBQMKHJE";
            this.textEdit2.Properties.AllowFocused = false;
            this.textEdit2.Properties.Appearance.BackColor = Color.WhiteSmoke;
            this.textEdit2.Properties.Appearance.Options.UseBackColor = true;
            this.textEdit2.Properties.ReadOnly = true;
            this.textEdit2.Size = new Size(100, 0x15);
            this.textEdit2.TabIndex = 30;
            this.labelControl35.Location = new Point(0x1be, 50);
            this.labelControl35.Name = "labelControl35";
            this.labelControl35.Size = new Size(0x16, 14);
            this.labelControl35.TabIndex = 0x1d;
            this.labelControl35.Text = "(元)";
            this.textEdit3.DataBindings.Add(new Binding("EditValue", this.bindingSource, "SQMKHJE", true));
            this.textEdit3.Location = new Point(340, 0x2f);
            this.textEdit3.Name = "textEdit13";
            this.textEdit3.Properties.AllowFocused = false;
            this.textEdit3.Properties.Appearance.BackColor = Color.WhiteSmoke;
            this.textEdit3.Properties.Appearance.Options.UseBackColor = true;
            this.textEdit3.Properties.ReadOnly = true;
            this.textEdit3.Size = new Size(100, 0x15);
            this.textEdit3.TabIndex = 0x1c;
            this.labelControl34.Location = new Point(0x109, 0x53);
            this.labelControl34.Name = "labelControl34";
            this.labelControl34.Size = new Size(0x48, 14);
            this.labelControl34.TabIndex = 0x1b;
            this.labelControl34.Text = "累计垫付金额";
            this.labelControl28.Location = new Point(0x1d, 0x53);
            this.labelControl28.Name = "labelControl28";
            this.labelControl28.Size = new Size(0x48, 14);
            this.labelControl28.TabIndex = 0x1a;
            this.labelControl28.Text = "本期垫付金额";
            this.labelControl29.Location = new Point(0xd5, 50);
            this.labelControl29.Name = "labelControl29";
            this.labelControl29.Size = new Size(0x16, 14);
            this.labelControl29.TabIndex = 0x19;
            this.labelControl29.Text = "(元)";
            this.labelControl30.Location = new Point(0x1e9, 50);
            this.labelControl30.Name = "labelControl30";
            this.labelControl30.Size = new Size(0x54, 14);
            this.labelControl30.TabIndex = 0x17;
            this.labelControl30.Text = "本期末扣回金额";
            this.labelControl31.Location = new Point(0x1d, 50);
            this.labelControl31.Name = "labelControl31";
            this.labelControl31.Size = new Size(0x48, 14);
            this.labelControl31.TabIndex = 0x15;
            this.labelControl31.Text = "本期扣回金额";
            this.textEdit4.DataBindings.Add(new Binding("EditValue", this.bindingSource, "BQKHJE", true));
            this.textEdit4.Location = new Point(0x6b, 0x2f);
            this.textEdit4.Name = "textEdit12";
            this.textEdit4.Properties.AllowFocused = false;
            this.textEdit4.Properties.Appearance.BackColor = Color.WhiteSmoke;
            this.textEdit4.Properties.Appearance.Options.UseBackColor = true;
            this.textEdit4.Properties.ReadOnly = true;
            this.textEdit4.Size = new Size(100, 0x15);
            this.textEdit4.TabIndex = 20;
            this.labelControl32.Location = new Point(0xfd, 50);
            this.labelControl32.Name = "labelControl32";
            this.labelControl32.Size = new Size(0x54, 14);
            this.labelControl32.TabIndex = 0x13;
            this.labelControl32.Text = "上期末扣回金额";
            this.XDSLSFKWM.Appearance.ForeColor = Color.Blue;
            this.XDSLSFKWM.Appearance.Options.UseForeColor = true;
            this.XDSLSFKWM.Location = new Point(8, 9);
            this.XDSLSFKWM.Name = "labelControl33";
            this.XDSLSFKWM.Size = new Size(0x120, 14);
            this.XDSLSFKWM.TabIndex = 0x11;
            this.XDSLSFKWM.Text = "说明：按合同条款分期分次扣回预先支付的材料预付款";
            this.panelControl1.Controls.Add(this.simpleButton24);
            this.panelControl1.Controls.Add(this.simpleButton3);
            this.panelControl1.Dock = DockStyle.Top;
            this.panelControl1.Location = new Point(0x183, 0x8d);
            this.panelControl1.Name = "panelControl1";
            this.panelControl1.Size = new Size(0x20e, 0x1b);
            this.panelControl1.TabIndex = 0x24;
            this.simpleButton24.Dock = DockStyle.Left;
            this.simpleButton24.Location = new Point(0x48, 2);
            this.simpleButton24.Name = "simpleButton24";
            this.simpleButton24.Size = new Size(70, 0x17);
            this.simpleButton24.TabIndex = 9;
            this.simpleButton24.Tag = "-1";
            this.simpleButton24.Text = "删除批号";
            this.simpleButton24.Click += new EventHandler(this.simpleButton24_Click);
            this.simpleButton3.Dock = DockStyle.Left;
            this.simpleButton3.Location = new Point(2, 2);
            this.simpleButton3.Name = "btnAddCLPC";
            this.simpleButton3.Size = new Size(70, 0x17);
            this.simpleButton3.TabIndex = 8;
            this.simpleButton3.Tag = "-1";
            this.simpleButton3.Text = "新增批号";
            this.simpleButton3.Click += new EventHandler(this.simpleButton3_Click);
            base.AutoScaleDimensions = new SizeF(6f, 12f);
            base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            base.ClientSize = new Size(0x391, 0x1fb);
            base.Controls.Add(this.gridControl6);
            base.Controls.Add(this.panelControl1);
            base.Controls.Add(this.gridControl10);
            base.Controls.Add(this.panelControl17);
            base.Controls.Add(this.panelControl16);
            base.Name = "FrmCLYFK_GQKH";
            this.Text = "扣回材料预付款_隔期扣回";
            base.FormClosing += new FormClosingEventHandler(this.vroAaJyIa);
            base.Load += new EventHandler(this.FrmCLYFK_GQKH_Load);
            base.ds.EndInit();
            base.dsQuery.EndInit();
            base.dataSets.EndInit();
            this.gridControl6.EndInit();
            ((ISupportInitialize) this.bindingSource1).EndInit();
            this.gridView6.EndInit();
            this.repositoryItemCheckEdit4.EndInit();
            this.gridControl10.EndInit();
            ((ISupportInitialize) this.bindingSource2).EndInit();
            this.gridView.EndInit();
            this.panelControl17.EndInit();
            this.panelControl17.ResumeLayout(false);
            this.panelControl16.EndInit();
            this.panelControl16.ResumeLayout(false);
            this.panelControl16.PerformLayout();
            this.textEdit.Properties.EndInit();
            ((ISupportInitialize) this.bindingSource).EndInit();
            this.textEdit1.Properties.EndInit();
            this.textEdit2.Properties.EndInit();
            this.textEdit3.Properties.EndInit();
            this.textEdit4.Properties.EndInit();
            this.panelControl1.EndInit();
            this.panelControl1.ResumeLayout(false);
            base.ResumeLayout(false);
        }

        public override void LoadedForm()
        {
            base.statusBS = this.bindingSource1;
            base.ds.Tables["QTJL_CLYFKCLPC"].ColumnChanged += new DataColumnChangeEventHandler(this.method5);
            base.SetBindingSource(this.bindingSource, "QTJL_CLYFK", false);
            base.SetBindingSource(this.bindingSource2, "QTJL_CLYFKCL", false);
            base.SetBindingSource(this.bindingSource1, "QTJL_CLYFKCLPC", false);
            this.bindingSource1.PositionChanged += new EventHandler(this.bindingSource1_PositionChanged);
            this.bindingSource2.PositionChanged += new EventHandler(this.bindingSource2_PositionChanged);
            this.bindingSource2.Position = this.bindingSource2.Count;
            this.method1();
            base.LoadedForm();
        }

        public override void LoadingData()
        {
            base.LoadingData();
            base.ida = DBHelp.IniIDA();
            base.ds.Clear();
            string str = null;
            str = "select * from QTJL_CLYFK " + Class28.YfQclfhSo(GParams.QCInfo.QCID, "");
            Class39.smethod4(base.ida, base.ds, str, "QTJL_CLYFK", true);
            str = string.Format("select * from ZZJGXXEX where id='{0}'", GParams._BDID);
            Class39.smethod4(base.ida, base.ds, str, "ZZJGXXEX", true);
            DataTable table = base.ds.Tables["ZZJGXXEX"];
            this.gqkk = new GQKK(table.Rows[0]["KCLYYKGS"].ToString());
            DHelp.GetObjId(this.bindingSource);
            str = "select * from QTJL_CLYFKCL " + Class28.YfQclfhSo(GParams.QCInfo.QCID, "");
            Class39.smethod4(base.ida, base.ds, str, "QTJL_CLYFKCL", true);
            DHelp.GetIds(base.ds.Tables["QTJL_CLYFKCL"], "id", "");
            str = "select * from QTJL_CLYFKCLPC " + Class28.YfQclfhSo(GParams.QCInfo.QCID, "");
            Class39.smethod4(base.ida, base.ds, str, "QTJL_CLYFKCLPC", true);
        }

        private void lquywmUul()
        {
            DHelp.DataAddNew(this.bindingSource, "", "");
            DataRow dataRow = DHelp.GetDataRow(this.bindingSource);
            int num = Convert.ToInt16(GParams.QCInfo.QCID);
            int gQ = this.gqkk.GQ;
            int kHJDQ = this.gqkk.KHJDQ;
            decimal num4 = 0M;
            decimal num5 = 0M;
            decimal num6 = 0M;
            decimal num7 = 0M;
            decimal num8 = 0M;
            if ((num > 1) && ((num - gQ) > 0))
            {
                string str = string.Format("select * from QTJL_CLYFK  where bdid='{0}' and qcid>{1} and qcid<={2}", GParams._BDID, (num - kHJDQ) - gQ, num - kHJDQ);
                Class39.smethod4(base.ida, base.ds, str, "dtGq", true);
                DataTable table = base.ds.Tables["dtGq"];
                int num9 = 0;
                int num10 = 0;
                foreach (DataRow row2 in table.Rows)
                {
                    num9 = Convert.ToInt16(row2["qcid"]);
                    num10 = Convert.ToInt16((int) (Convert.ToInt16(row2["BQDFJE"]) / kHJDQ));
                    if (((num9 - gQ) - kHJDQ) == 0)
                    {
                        num4 += Convert.ToInt16(row2["BQDFJE"]) - (num10 * (kHJDQ - 1));
                    }
                    else
                    {
                        num4 += num10;
                    }
                }
                str = "select * from QTJL_CLYFK " + Class28.YfQclfhSo(num - 1, "");
                Class39.smethod4(base.ida, base.ds, str, "dtSq", true);
                num5 = DHelp.ToDecimal(base.ds.Tables["dtSq"].Rows[0]["BQMKHJE"]);
                num7 = DHelp.ToDecimal(base.ds.Tables["dtSq"].Rows[0]["LJDFJE"]);
            }
            num6 = num4 + num5;
            num8 = num7;
            dataRow["BQKHJE"] = num4;
            dataRow["SQMKHJE"] = num5;
            dataRow["BQMKHJE"] = num6;
            dataRow["BQDFJE"] = 0;
            dataRow["SQMDFJE"] = num7;
            dataRow["LJDFJE"] = num8;
            dataRow.EndEdit();
        }

        private void method1()
        {
            DataRow row;
            DataTable table = base.ds.Tables["QTJL_CLYFK"];
            table.TableNewRow += new DataTableNewRowEventHandler(Class28.smethod);
            if (table.Rows.Count == 0)
            {
                row = table.NewRow();
                table.Rows.Add(row);
            }
            else
            {
                row = table.Rows[0];
            }
            Class39.smethod1(base.ida, row, GParams.QCInfo.QCID, GParams._BDID);
        }

        private void method2(object sender, DataTableNewRowEventArgs e)
        {
            string str = DHelp.GetObjValue(this.bindingSource2, "DFBL", true);
            e.Row["DFBL"] = str;
            e.Row["JE"] = 0;
        }

        private void method3()
        {
            decimal num = 0M;
            decimal num2 = 0M;
            DataRow dataRow = DHelp.GetDataRow(this.bindingSource2);
            if (dataRow != null)
            {
                string str = dataRow["id"].ToString();
                num = DHelp.ToDecimal(base.ds.Tables["QTJL_CLYFKCLPC"].Compute("sum(JE)", "PID='" + str + "'"));
                num2 = DHelp.ToDecimal(base.ds.Tables["QTJL_CLYFKCLPC"].Compute("sum(DFJE)", "PID='" + str + "'"));
                dataRow["JE"] = num;
                dataRow["DFJE"] = num2;
                dataRow.EndEdit();
            }
        }

        private void method4()
        {
            decimal num = 0M;
            decimal num2 = 0M;
            DataRow dataRow = DHelp.GetDataRow(this.bindingSource);
            string str = dataRow["id"].ToString();
            num = CHelp.ConvertDecimal(base.ds.Tables["QTJL_CLYFKCL"].Compute("sum(DFJE)", "PID='" + str + "'"), 0, 0);
            num2 = CHelp.ConvertDecimal(dataRow["SQMDFJE"], 0, 0);
            dataRow["BQDFJE"] = num;
            dataRow["LJDFJE"] = num + num2;
            dataRow.EndEdit();
        }

        private void method5(object sender, DataColumnChangeEventArgs e)
        {
            decimal num = 0M;
            decimal num2 = 0M;
            decimal o = 0M;
            decimal num4 = 0M;
            DataRow row = e.Row;
            if ((e.Column.ColumnName.Equals("DJ") || e.Column.ColumnName.Equals("SL")) || e.Column.ColumnName.Equals("DFBL"))
            {
                if (e.Column.ColumnName.Equals("DJ"))
                {
                    num = CHelp.ConvertDecimal(e.ProposedValue, 0, 2);
                    num2 = CHelp.ConvertDecimal(DHelp.GetValue(row, "SL"), 0, 3);
                    num4 = DHelp.GetValue(row, "DFBL");
                }
                if (e.Column.ColumnName.Equals("SL"))
                {
                    num2 = DHelp.ToDecimal(e.ProposedValue);
                    num = DHelp.GetValue(row, "DJ");
                    num4 = DHelp.GetValue(row, "DFBL");
                }
                if (e.Column.ColumnName.Equals("DFBL"))
                {
                    num4 = DHelp.ToDecimal(e.ProposedValue);
                    num = DHelp.GetValue(row, "DJ");
                    num2 = DHelp.GetValue(row, "SL");
                }
                o = num * num2;
                o = CHelp.ConvertDecimal(o, 0, 0);
                row["JE"] = o;
                row["DFJE"] = CHelp.ConvertDecimal((o * num4) / 100M, 0, 0);
                this.method3();
                this.method4();
            }
        }

        private void method6(object sender, EventArgs e)
        {
            base.Save();
        }

        private void method7()
        {
            if ((this.bindingSource2.Current != null) && (this.bindingSource2.Current is DataRowView))
            {
                DataRow row = (this.bindingSource2.Current as DataRowView).Row;
                this.bindingSource1.Filter = "PID='" + row["ID"].ToString() + "'";
            }
        }

        private void method8()
        {
            if ((this.bindingSource2.List.Count > 0) && (MsgBox.ShowQuestion("是否删除当前材料及材料下的批次信息") == System.Windows.Forms.DialogResult.OK))
            {
                while (this.bindingSource1.List.Count > 0)
                {
                    this.bindingSource1.RemoveCurrent();
                }
                this.bindingSource2.RemoveCurrent();
                this.method3();
                this.method4();
                base.Save();
            }
        }

        public override void Saving()
        {
            this.textEdit2.Focus();
            base.Saving();
        }

        private void simpleButton_Click(object sender, EventArgs e)
        {
            using (FrmCLSelect select = new FrmCLSelect())
            {
                string objId = DHelp.GetObjId(this.bindingSource);
                select.SetClDt(base.ds.Tables["QTJL_CLYFKCL"], objId);
                select.ShowDialog();
            }
        }

        private void simpleButton1_Click(object sender, EventArgs e)
        {
            this.method8();
        }

        private void simpleButton2_Click(object sender, EventArgs e)
        {
            string objId = DHelp.GetObjId(this.bindingSource);
            base.OpenDataLog("QTJL_CLYFK", GParams._BDID, GParams.QCInfo.QCID, objId);
        }

        private void simpleButton24_Click(object sender, EventArgs e)
        {
            if ((this.bindingSource1.List.Count > 0) && (MsgBox.ShowQuestion("是否删除当前选中的批号？") == System.Windows.Forms.DialogResult.OK))
            {
                this.bindingSource1.RemoveCurrent();
                this.method3();
                this.method4();
                base.Save();
            }
        }

        private void simpleButton3_Click(object sender, EventArgs e)
        {
            if (this.bindingSource2.List.Count > 0)
            {
                DataRow row = DHelp.DataAddMxRow(this.bindingSource1, this.bindingSource2);
                row["DFBL"] = DHelp.GetObjValue(this.bindingSource2, "DFBL", false);
                row.EndEdit();
                this.gridView6.Focus();
            }
        }

        private void vroAaJyIa(object sender, FormClosingEventArgs e)
        {
        }
    }
}

